<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php


class EOAuthProvider extends EOAuthComponent {
    public $consumer;
    public $token;

    public $request_token_endpoint=
            'https://www.google.com/accounts/OAuthGetRequestToken';
    public $authorize_token_endpoint =
            'https://www.google.com/accounts/OAuthAuthorizeToken';
    public $access_token_endpoint =
            'https://www.google.com/accounts/OAuthGetAccessToken';

    
    public function __construct($consumer=null, $token=null) {
        $this->consumer = $consumer;
        $this->token = $token;

    }

    
    public function GetOAuthHeader($url) {
        $signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
        $request = OAuthRequest::from_consumer_and_token($this->consumer,
                $this->token, 'POST', $url, array());
        $request->sign_request($signatureMethod, $this->consumer, $this->token);
        $header = $request->to_header();
        $pieces = explode(':', $header, 2);
        return trim($pieces[1]);
    }


}
